View Javadoc
1   package edu.jiangxin.apktoolbox.swing.extend.listener;
2   
3   import java.awt.Desktop;
4   import java.io.IOException;
5   import java.net.URI;
6   import java.net.URISyntaxException;
7   
8   import org.apache.logging.log4j.LogManager;
9   import org.apache.logging.log4j.Logger;
10  
11  /**
12   * @author jiangxin
13   * @author 2019-03-31
14   *
15   */
16  public class ChangeMenuToUrlListener implements ChangeMenuListener {
17  
18      private static final Logger logger = LogManager.getLogger(ChangeMenuToUrlListener.class.getSimpleName());
19  
20      private String url;
21  
22      public ChangeMenuToUrlListener(String url) {
23          super();
24          this.url = url;
25      }
26  
27      @Override
28      public void onChangeMenu() {
29          URI uri;
30          try {
31              uri = new URI(url);
32              Desktop.getDesktop().browse(uri);
33          } catch (URISyntaxException ex) {
34              logger.error("URISyntaxException", ex);
35          } catch (IOException ex) {
36              logger.error("IOException", ex);
37          }
38      }
39  
40  }